<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/jsp/common/common.jsp"%>
<script type="text/javascript" src="<%=contextPath%>/js/jquery.autogrow.js"></script> 
<html>
	<head>	
		<script type="text/javascript">
		$(document).ready (function() {
			
			$('textarea').autogrow();		
		});
			Ext.onReady(function(){
				var tb = new Ext.Toolbar({
				    renderTo: Ext.get('tbar'),
				    items: [
				        {
				            text: '保存',
				            icon:"<%=contextPath%>/" + "images/save.gif",
				            handler:function(){
				            	savegzjl();
				            }
				        },'-', {
				            text: '归档',
				            icon:"<%=contextPath%>/" + "images/save.gif",
				            handler:function(){
				            	historygzjl();
				            }
				        }]
				});
			});
		</script>
	</head>
	<body>
		<div id ='tbar'></div>
		<form id="frmM" class="ct" name="frmM" method="POST" action="">
			<table width="100%" height="30">
				<tr>
					<td colspan="4" align="center">
						工作记录详细信息
					</td>
				</tr>
			</table>			
			<table width="100%" id="contab" >
				<tr>
					<th>任务单号</th>
					<td>
						<input type="hidden" name="entity.id" value="${entity.id}"/>
						<input type="hidden" name="entity.bzlb" value="${entity.bzlb}"/>
						<input type="hidden" name="entity.gzrwdid" value="${entity.gzrwdid}"/>
						<input type="hidden" name="entity.cjrid" value="${entity.cjrid}"/>  
						<a href="#" onClick="javascript:toGzrwdDetail('<c:out value="${entity.gzrwdid}"/>')" >${gzrwd.bh}</a>
					</td>						
					<th>开始时间</th>
					<td><input type="text" name="entity.kssj" value='<fmt:formatDate value="${entity.kssj}" pattern="yyyy-MM-dd HH:mm"/>' readonly="readonly"/></td>
					<th>负责人</th>
					<td><input type="text" name="entity.fzr" value="${entity.fzr}" readonly="readonly"/></td>	
					<th>记录人</th>
					<td><input type="text" name="entity.jlr" value="${entity.jlr}" readonly="readonly"/></td>	
				</tr>
				<tr>
					<th>变电站</th>
					<td><input type="text" name="entity.bdzname" value="${entity.bdzname}" readonly="readonly"/></td>
					<th>结束时间</th>
					<td><input type="text" name="entity.jssj" value='<fmt:formatDate value="${entity.jssj}" pattern="yyyy-MM-dd HH:mm"/>' readonly="readonly"/></td>
					<th>工作成员</th>
					<td><input type="text" name="entity.gzcy" value="${entity.gzcy}" readonly="readonly"/></td>	
					<th>记录日期</th>
					<td><input type="text" name="entity.jlrq" value='<fmt:formatDate value="${entity.jlrq}" pattern="yyyy-MM-dd HH:mm"/>' readonly="readonly"/></td>									
				</tr>			
			</table>
			<hr>
			<table width="100%" id="listtab">
				<tr>
					<th>设备类别</th>
					<th>设备名称</th>
					<th>工作内容</th>
					<th>工作情况</th>
					<th>遗留问题<br/><font color="red">没有遗留问题请先写无</font></th>
					<th>是否完成</th>
				</tr>
				<c:forEach items="${showList}" var="Tab" varStatus="status">
					<tr>
						<td>
							<input type="text" name="sblxname" value="${Tab.sblxname}" readonly="readonly"/>
							<input type="hidden" name="bzgzrwList[${status.index}].sblx" value="${Tab.sblx}"/>
							<input type="hidden" name="bzgzrwList[${status.index}].id" value="${Tab.id}"/>
							<input type="hidden" name="bzgzrwList[${status.index}].bzid" value="${Tab.bzid}"/>
							<input type="hidden" name="bzgzrwList[${status.index}].dydj" value="${Tab.dydj}"/>
							<input type="hidden" name="bzgzrwList[${status.index}].bzgs" value="${Tab.bzgs}"/>
							<input type="hidden" name="bzgzrwList[${status.index}].planid" value="${Tab.planid}"/>
							<input type="hidden" name="bzgzrwList[${status.index}].sbqxid" value="${Tab.sbqxid}"/>
						</td>
						<td>
						<input type="text" size="30" name="bzgzrwList[${status.index}].sbname" value="${Tab.sbname}" readonly="readonly"/>
						
						</td>
						<td style="width:20%">
							<textarea readonly="readonly" style="width:100%; height: 25px; min-height: 20px;line-height:15pt" id="bzgzrwList[${status.index}].gznr" name="bzgzrwList[${status.index}].gznr">${Tab.gznr}</textarea>
						
						</td>
						<td style="width:20%">
							<textarea style="width:100%; height: 25px; min-height: 20px;line-height:15pt" id="bzgzrwList[${status.index}].gzqk" name="bzgzrwList[${status.index}].gzqk">${Tab.gzqk}</textarea>
						</td>
						<td style="width:20%">
							<textarea style="width:100%; height: 25px; min-height: 20px;line-height:15pt" id="bzgzrwList[${status.index}].ylwt" name="bzgzrwList[${status.index}].ylwt">${Tab.ylwt}</textarea>
					
						</td>
						<td>
							<select style="width:50" id="bzgzrwList[${status.index}].finishflag" name="bzgzrwList[${status.index}].finishflag">
						 	 <option value ="" ${Tab.finishflag==''?'selected':'' }></option>
									  <option value ="0" ${Tab.finishflag=='0'?'selected':'' }>否</option>
									  <option value ="1" ${Tab.finishflag=='1'?'selected':'' }>是</option>		
								</select>
						</td>
					</tr>
				</c:forEach>
				<c:if test="${showList == null || fn:length(showList) == 0 }">
					<tr>
						<td colspan="12" style="text-align: center">
							无记录
						</td>
					</tr>
				</c:if>
			</table>
			<table width="100%" id="tablestyle2">
				<tr>
					<td>
						<hr />
					</td>
				</tr>
				<tr>
					<td>${pageDown}</td>
				</tr>
			</table>
		</form>
	</body>
<script>
	
		function savegzjl(){
			document.frmM.action = "<%=contextPath%>/gzjl!savegzjl.do?flag=1";
			document.frmM.submit();
		}
		function historygzjl(){//归档工作记录
			var flag = document.getElementById("flag").value;
			//alert(flag);
			if(flag == '1'){
				document.frmM.action = "<%=contextPath%>/gzjl!savehistory.do?flag=" + flag;
				document.frmM.submit();
			}else{
				document.frmM.action = "<%=contextPath%>/gzjl!savehistory.do";
				document.frmM.submit();
				window.close();
			}
		}
		function toGzrwdDetail(id){
			document.frmM.action = "<%=contextPath%>/gzrwd!initDetail.do?id=" + id;
			document.frmM.submit();				
		}
</script>
</html>
